Check which condition has met - Sql Server In a simple scalar function, I got several "IFs" separated each of them with a unique condition.

Is there any way that I can check which condition was satisfied without having to change the function to log my conditions?

IF ( SOME CONDITION) RETURN 1;

IF ( SOME OTHER CONDITION ) RETURN 1;


What I need to do is check if the condition met was the first or the second.

EDIT:
I know this looks terrible but I also need to get the SQL code that made the condition work. I have no idea how this is possible but I'm hoping any solution.
Turn your function into an in-line table-valued function, and then pass your extra info in other columns. You can easily call it using CROSS APPLY in your FROM clause, and then use the result in WHERE predicates, SELECT lists, wherever you like. Plus being an ITVF, it’ll perform much better.