title: Can we pass database name in a SQL query as parameter?
body: <p>Consider the following queries, where only database name differs (on same server)</p>
  
  <pre><code>Select * from sampledev.dbo.Sample
  Select * from sampleqa.dbo.Sample
  </code></pre>
  
  <p>The above queries are part of a procedure. Every time I have to run the procedure, I have to make sure it references the correct database (and do rename, if it is not).</p>
  
  <p>I want to pass the database name as a parameter to the stored procedure. The question is, is it possible? If yes, how?</p>