DECLARE @sqlQuery NVARCHAR(MAX); -- Declare the variable to hold the dynamic SQL statement DECLARE @columnNaame NVARCHAR(50) = 'name'; -- Example parameter SET @sqlQuery = 'SELECT ' + @columnName + ' FROM employees'; -- Build the SQL statement dynamically EXECUTE sp_executesql @sqlQuery; -- Execute the dynamic SQL statement