You have pretty much discovered the reason for the problem. NULL is never equal to anything, not even to another NULL.
One workaround for this is that you eliminate NULL's from the comparison by replacing it with another value. Perhaps the easiest way is to use
COALESCE[
^]. Using that, your example would be something like:
WHERE COALESCE(RepCode, -1) = COALESCE(@RepCode, -1)
So the idea is that you replace the NULL with some other value.
Important: Just make sure that the value does not exist in the data since that would bring false results.