Inside stored procedure, set column names of returned query according to variable
You'll need to use dynamic SQL for this, if you truly want SQL Server to pass back results with variable column names.

By way of an example, consider the following:

Use tempdb to avoid any nasty surprises to existing objects:

USE tempdb;


Create a table to hold the sample data.  Since we are using dynamic SQL, we cannot use a table variable for this.

IF OBJECT_ID('dbo.Animals') IS NOT NULL
DROP TABLE dbo.Animals;

CREATE TABLE dbo.Animals 
(
    AnimalType varchar(20) NOT NULL
    , AnimalName varchar(20) NOT NULL
);

INSERT INTO dbo.Animals (AnimalType, AnimalName)
VALUES ('Cat', 'Garfield')
    , ('Dog', 'Lucy');

GO


Create a stored procedure using dynamic T-SQL:

IF OBJECT_ID('dbo.DynamicResults') IS NOT NULL
DROP PROCEDURE dbo.DynamicResults;
GO
CREATE PROCEDURE dbo.DynamicResults
(
    @DogsOrCats varchar(3)
)
AS
BEGIN
    SET NOCOUNT ON;
    DECLARE @msg nvarchar(1000);
    IF (@DogsOrCats = 'Dog' OR @DogsOrCats = 'Cat')
    BEGIN
        DECLARE @cmd nvarchar(max);
        DECLARE @vars nvarchar(max);
        SET @vars = '@Type varchar(20)';
        SET @cmd = 'SELECT a.AnimalType
            , [NumberOf' + @DogsOrCats + 's] = COUNT(1)
        FROM dbo.Animals a
        WHERE a.AnimalType = @Type
        GROUP BY a.AnimalType;';
        EXEC sys.sp_executesql @cmd, @vars, @Type = @DogsOrCats;
    END
    ELSE
    BEGIN
        SET @msg = '@DogsOrCats must be either ''Dog'' or ''Cat''';
        RAISERROR (@msg, 14, 1) WITH NOWAIT;
    END
END
GO


Running the stored proc returns varying result sets, based on the value passed in as @DogsOrCats

EXEC dbo.DynamicResults 'Cat';


Returns:


+------------+--------------+
| AnimalType | NumberOfCats |
+------------+--------------+
| Cat        |            1 |
+------------+--------------+


EXEC dbo.DynamicResults 'Dog';


Returns:


+------------+--------------+
| AnimalType | NumberOfDogs |
+------------+--------------+
| Dog        |            1 |
+------------+--------------+