The question intrigued me and I did find one way. It makes it happen but if you just wanted to give a lot of aliases one time in one query I wouldn't recommend it though.
First I made a stored procedure that extracts all the column names and gives them an alias without '_'.
USE [DataBase]
GO
IF OBJECT_ID('usp_AlterColumnDisplayName', 'P') IS NOT NULL
DROP PROCEDURE usp_AlterColumnDisplayName
GO
CREATE PROCEDURE usp_AlterColumnDisplayName
@TableName VARCHAR(50)
,
@ret nvarchar(MAX) OUTPUT
AS
Select @ret = @ret + [Column name]
From
(
SELECT ([name] + ' AS ' + '[' + REPLACE([name], '_', ' ') + '], ') [Column name]
FROM syscolumns
WHERE id =
(Select id
From sysobjects
Where type = 'U'
And [name] = @TableName
)
) T
GO
Then extract that string and throw it into another string with a query-structure.
Execute that and you are done.
DECLARE @out NVARCHAR(MAX), @DesiredTable VARCHAR(50), @Query NVARCHAR(MAX)
SET @out = ''
SET @DesiredTable = 'YourTable'
EXEC usp_AlterColumnDisplayName
@TableName = @DesiredTable,
@ret = @out OUTPUT
SET @out = LEFT(@out, LEN(@out)-1) --Removing trailing ', '
SET @Query = 'Select ' + @out + ' From ' + @DesiredTable + ' WHERE whatever'
EXEC sp_executesql @Query
If you just wanted to give a lot of aliases at once without sitting and typing it out for 80+ columns I would rather suggest doing that with one simple SELECT
statement, like the one in the sp, or in Excel and then copy paste into your code.