Needed a function to de-duplicate string lists, so I modified a similar UDF from SQLAuthority. That original UDF didn’t preserve the position of list elements or handle case sensitive comparisons, and I wasn’t too keen on the variable naming. Anyway, my version is below and let’s you specify the list delimiter as well as control case sensitivity, in addition to preserving the original sequence of list items.