• Thanks all for the great advice. Rewriting the sproc is not an option at this time. Since this is just a wrapper around the real work horse, I guess it's really going to make little difference how the wrapper is coded. It seems like in this particular situation an RBAR solution is almost a clearer representation of what's going on. I'm finding that the real problem is that this sproc was not very well optimized, that's where I'm going to need to focus my time.

    I'll definitely keep the cross apply / function up my sleeve for next time. Although, a colleague of mine is trying to convince us to stay away from UDF's. Seems the optimizer really doesn't deal with them very well in most common situations. I think table value functions might be a little more optimizer friendly.

    .