If you use ALTER FUNCTION or REPLACE FUNCTION on a row-level security UDF, the resulting UDF must retain all parameters specified in the constraint definitions that use the UDF.
Example: Setting the Protection Mode of a UDF to EXECUTE NOT PROTECTED
ALTER FUNCTION TransXML EXECUTE NOT PROTECTED;
Example: Setting a Recompiled UDF to EXECUTE NOT PROTECTED
An existing UDF named XPathValue must be recompiled for some reason. XPathValue had previously been set to run in unprotected mode. Recompiling a UDF always resets its protection mode back to protected, so you must follow any recompilation with another ALTER FUNCTION request to set its protection mode back to unprotected.
ALTER FUNCTION XPathValue COMPILE; ALTER FUNCTION XPathValue EXECUTE NOT PROTECTED;