Stored procedure EXEC vs sp_executesql difference?
Your sp_executesql SQL should probably be; DECLARE @SQL as nvarchar(128) = ‘select ‘ + @Columns + ‘ from ‘ + @TableName + ‘ where Status=@eStatus’ This will allow you to call sp_executesql with @eStatus as a parameter instead of embedding it into the SQL. That will give the advantage that @eStatus can contain any characters … Read more