From the description it sounds like an inline function, but I have to ask, is it? If it's a multi-statement UDF, that could explain the performance issues too.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning