A great way to do this! One thing I noticed is that the consecutive REPLACE functions at the end of the SP don't really do anything (i.e. they replace '<' with itself). I changed the code to this and it seemed to work: ... + REPLACE(
REPLACE(@BodyHTML, '<', '<') ,
'>' ,
'>') ...
Note: I have not fully tested this so use at your own risk 🙂
Thanks for the innovative approach 🙂