You have veered from your initial target, interesting though it was. A simple resolution to allow the SELECT statment to be authored only once (best programming practice), is to use the NVL() function in the WHERE clause associated with the LIKE operand.

WHERE category_id LIKE NVL(@categoryID, '%')

The NVL will return the value of @categoryID if this is not NULL, or if it is NULL then it will return a '%' sign. The LIKE operand will now enforce either a match only to the value of @categoryID, or to everthing in the table.