Rimin K said..
While user defined functions can offer great convenience, they can also sometimes hurt performance. This problem with them is that they use row-by-row processing, similar to how a cursor works, instead of working as a set-based operation. So if the result set of your query, which is using a user defined function, is very small, then the performance hit will be small. But if the result set is large, then performance could very well become a problem.
Means, if you are using a user defined function, you will want to avoid using them with large result sets. Instead, use a well-written stored procedure instead.