• You have to issue a USE statement or quantify the object names in the queries with the database name. Neither method supports using a parameter which is why all you'll see for this type of operation is dynamic SQL.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning