Nice little technique.
Reminds me of when I realised the power of of using
(col = @arg OR Len(@arg) = 0)
for only using passed values in joins when needed without cumbersom if-else statements or dynamic sql.
A captivating hands-on how-to article. Although I do not have a current need for such a large scale email system, I would not have thought that SQL Server would be a possible solution. I think it is a very innovative use. Thank you for jolting my cerebal cortex. Now, when the need comes up, I will KNOW it can be done and KNOW how to do it.
This type of article and content is the exact reason why I subscribe to sqlservercentral.