• I'll try to get the thread back on track and answer your actual question...

    My experience is a proc gets written once and then goes through dozens of enhancements for the lifetime of a project. Therefore, one should always put in extra effort the very first time it is written so that it is extremely easy for others to understand and enhance later. Paying the price up-front in writing a derived table will make the rest of the query easier to understand and write.

    I really like your longer script because it makes explicit the over-multiplexed information hidden in a single column. And I really like deriving tables in the FROM CLAUSE so that it normalizes poorly designed tables. Derived tables can also greatly encapsulate filtering and logic in a single place, allowing one to reuse sub-queries.