title: Use database inside a stored procedure
body: <p>I need to make a stored procedure which creates a user in more than one database. Something like this:</p>
  
  <pre><code>USE [database1]
  
  CREATE USER [userLogin] FOR LOGIN [userLogin]
  
  USE [database2]
  
  CREATE USER [userLogin] FOR LOGIN [userLogin]
  </code></pre>
  
  <p>Since the <code>CREATE USER</code> statement does his job in the current database I need to use the <code>USE</code> statement to change between databases, but it can't be used inside stored procedures.</p>
  
  <p>How can I do this?</p>