I am always hesitant about giving answers that suggest dynamic SQL, often when dynamic SQL is required, the problem is best solved outside of SQL. Erland Sommarskog has written pretty extensively on the subject - The Curse and Blessings of Dynamic SQL
Anyway, your problem can be solved using dynamic SQL. You can build your SQL using the system views, and concatenate the column name using SQL Server's XML extensions:
DECLARE @TableName SYSNAME = 'dbo.table1';
DECLARE @SQL NVARCHAR(MAX) =
'SELECT CONCAT(' + STUFF(( SELECT ','','',' + QUOTENAME(c.Name)
FROM sys.columns c
WHERE c.object_id = OBJECT_ID(@TableName, 'U')
ORDER BY Column_id
FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 5, '') + ')
FROM ' + @TableName + ';';
EXECUTE sp_executesql @SQL;
So for this table:
CREATE TABLE dbo.Table1
(
Col1 VARCHAR(10),
Col2 VARCHAR(10),
Col3 INT,
Col4 INT,
Col5 VARCHAR(30)
);
The SQL that is generated is:
SELECT CONCAT([Col1],',',[Col2],',',[Col3],',',[Col4],',',[Col5])
FROM dbo.table1;