Oof.
A new dev wrote a procedure. I think they may have broken every best practice I'm aware of for a short #SQL report procedure.
Columns in a nonsensical order, temp tables galore each holding maybe a single row of data, hitting the database for every UPDATE instead of collecting the data needed into a local table and working from that...
I think I'll suggest one improvement and refer them to an article on SQL best practices. They need to improve, but at the same time I don't want them to get discouraged while learning.
Also, the procedure works. So there's that.
Looking at the output, it needs some adjustment before it'll be usable for an SSRS template to ingest it.
I'm going to be busy for a bit tonight...

4