How to define macros in SQL server?
I sort of simulate macros using dynamic SQL, but it's pretty clunky since this isn't what T-SQL was designed for.

DECLARE @sql nvarchar(max) = N'SELECT foo_$alias$ = 1;';

DECLARE @alias sysname = N'bar';

SET @sql = REPLACE(@sql, N'$alias$', @alias);

EXEC sys.sp_executesql @sql;


Output:

foo_bar
-------
      1


My concern would be that the consuming application is able to handle all of the potential column names coming back from the database (I assume your real example is more complex, because the application certainly has the ability to know the current month).