Check which condition has met - Sql Server
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.