Creating a Query for Notification:
When a command that registers a notification contains more than one statement, the Database Engine creates a notification for each statement in the batch.
So if you have control flow (if, else, while etc) then the path that was actually executed is the path that sets up the notifications. If a branch is not taken then no notification is set up, as no statement is executed in that branch. If a loop executes a statement repeatedly, a separate notification is set up for every execution.
As for UDFs the only one that matter are those that are basically inlined in the statement, since pretty much any other UDF would make the query invalid for notifications. Those inlined UDFs act as if you had written the expanded function definition in the statement. In other words, they don't change anything vis-a-vis the notificaiton. Is the statement that matters.
The gist of it is that only SELECT can set up a notification. When you execute a SP (or a batch) the notification is not set up for the 'SP' per-se, but instead the notifications are set up for each SELECT statement executed, as is being executed.