>I was wrong I just checked with someone and it is possible to have a blank judge code.
I asked a question two times and you ignored it both times so I'm going with my understanding of that condition. As Bo suggested, I would use NULL instaed of empty for parameters.
WHERE
-- judgecode is not empty
LEN(judgecode) > 0
AND ( @parameter IS NULL OR judgecode = @parameter)
--sb--