Haz un procedure con un query dinamico podria ser asi:
Código SQL:
Ver originalCREATE PROCEDURE miprocedure (variable1 AS VARCHAR(200, variable2 AS VARCHAR(200), variable3 AS VARCHAR(200)
BEGIN
DECLARE @query VARCHAR(MAX)
SET @query='select ' + @variable + 'from ' + @variable2 + ' where ' + @variable3
EXEC Sp_sqlExec @query
END
Saludos!