https://obscureproblemsandgotchas.com/development/sql-server/sql-server-replace-function-makes-expression-string-null-when-replacement-string-is-null/
Sql Server REPLACE function makes expression string NULL when replacement string is NULL