Is this what u want?DECLARE @s VARCHAR(8000)SELECT @s=@s + Column_name + ','from INFORMATION_SCHEMA.Columnswhere table_name = 'MyTable' and Column_name not in ( 'Unwanted_Column1' , 'Unwanted_Column2' ....)set @s = left(@s, Datalength(@s)-1)set @s = 'Select ' + @s + ' from MyTable'execute ( @s)
If u want the unwanted columns to be passed as parameters, u can modify the above with Unwanted columns as parameters and have the code in a stored procedure and modify accordingly to get the output.