Thanks for the question... easy one.... only because I've tried to do this too many times in the past.
I no longer try to do this... because I've found it generally better to make a pair of stored procs, one for each branch and either call them from another "switchboard" proc or have the code itself determine which one to call.