I have a comma delimited string with column names i.e.
"Column1, Column2, Column3" which will be passed as a parameter to the following stored procedure.
My Stored Procedure is as follows:
@ColNames VARCHAR(1000)
Select ROW_NUMBER() OVER (ORDER BY Column1, Column2, Column3) AS RowNum, 
Column1, Column2, Column3
INTO #Results
From Table A 
I want to replace the above hardcoded column names with the parameter @colNames. This will include splitting the comma delimited parameter into the individual column names. 
 
     
     
     
    