You cannot use ALTER FUNCTION to change the protection mode for a function and to request its recompilation within the same request. You must submit separate requests to to alter the execution protection mode and recompile.
If you attempt to request both a change to the execution mode and a recompilation within the same request, the system returns an error.