Get Column Names of Table - Microsoft Sql

This is how you can get the name of the columns from a table in MS SQL.

SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = 'TableName'

And if you want them as a comma separated list:

declare @list varchar(max)
select @list=COALESCE(@list+', ','')+COLUMN_NAME
FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = 'TableName'
select @list