Thanks for the answer. Unfortunately the function does not accept char-type for the AVG Operator. If I change @data_in to int (does not help because the column names are not int) the function is accepted.
So I decided to solve this little Problem with a view:
SELECT AVG(column1) rcol1, AVG(colmun2) rcol2, ... FROM (SELECT TOP 10 column1, column2, ... FROM table1 WHERE ...) u
Not nice but does the Job.
Anyhow thank for the help.