I\'m trying to create a simple stored procedure which queries a sys.tables table.
CREATE PROCEDURE dbo.test @dbname NVARCHAR(255), @col NVARCHAR(255
The only way to do this is to use Dynamic SQL, which is powerful but dangerous.
Read this article first.