MAV query is a very useful techique. I am sure it is something I am doing wrong (or is there a database setting I am missing) but I only get one column in my output when I should get 117.
declare @col_list varchar(4000), @tbl_name sysname
select @tbl_name = 'Master', @col_list = ''
--list all the columns first
select '[' + column_name + ']' as col
from information_schema.columns
where table_name = @tbl_name
--MAV query
select @col_list = @col_list + col + ', '
from (select '[' + column_name + ']' as col
from information_schema.columns
where table_name = @tbl_name) d
order by col
select @col_list
print @col_list
_________________________
(117 row(s) affected)
(1 row(s) affected)
[WorkPaidByAnother],