I think your approach is all wrong. You can calculate their age with some SQL date math code. Beyond that, your GetStudents function should not even exist. Whatever query is in the function can be put into the query that's calling the function. Calling a function in a query is very expensive in terms of performance, and should be avoided if possible. So, assuming you want the classname for all students of a certain age:
SELECT [ClassName]
FROM Students
WHERE @age = DATEDIFF(YEAR, CONVERT(DATE,GETDATE()), CONVERT(DATE,[DateOfBirth]))