C#
string strCols = "";
foreach (string strVal in DropDownList1.SelectedIValues)
{
strCols = strCols + strVal + ",";
}
pass strCols to stored procedure
cmd.Parameters.AddWithValue("@Cols", strCols);
SQL
ALTER PROCEDURE [dbo].[proc_test]
(
@cols nvarchar (MAX),
@tablename nvarchar(250)
)
AS
DECLARE @Query varchar(MAX)
SET @Query = 'SELECT ' + @cols + ' from ' + @tablename
EXEC(@Query)