With T-SQL this function
CREATE FUNCTION [dbo].[FuncOrder]
(
   @param1 int,
   @param2 int
)
RETURNS @returntable TABLE
(
   c1 int,
   c2 int
)
AS
BEGIN
   INSERT @returntable
   SELECT @param1 as c2, @param2 as c1
   RETURN
END
Executing with this
SELECT * FROM [dbo].[FuncOrder](
1,
2)
GO
Result is this
c1  c2
1   2
I was expecting that the column alias would be matched to the names in the return table definition. It seems to me that the order of the select columns matters and not the column alias. Does anyone have a link to where the documents say that.
 
     
    