There are certain top-level statements that must be executed first in the execution unit. You can close / close the execution block with the word GO
So:
USE [db] GO CREATE PROC....
If you are talking about a USE expression inside sproc, then no, you cannot do this. Sproc is already bound to the database in which it was created. If you want to access another database, you need to use a three-digit naming convention, for example. ELECS.dbo.tablename Assuming dbo is your schema.
source share