It seems I had a small bug in the udf code I posted. The return statement of the udf should be RETURN VARCHAR(4000) instead of just RETURN VARCHAR. ...
You just need to add an additional where clause that checks the column value equal to either of the passed in values. That would prevent the update statement from...