I am not sure if it can be done in a single parameter, but you can include several optional category parameters like this, and add them to the bottom of your template:
{{#if:{{{cat1|}}}|[[Category:{{{cat1}}}]]}}{{#if:{{{cat2|}}}|[[Category:{{{cat2}}}]]}}{{#if:{{{cat3|}}}|[[Category:{{{cat3}}}]]}}{{#if:{{{cat4|}}}|[[Category:{{{cat4}}}]]}}{{#if:{{{cat5|}}}|[[Category:{{{cat5}}}]]}}{{#if:{{{cat6|}}}|[[Category:{{{cat6}}}]]}}{{#if:{{{cat7|}}}|[[Category:{{{cat7}}}]]}}
So whe using the template, add extra parameters of:
|cat1= Category number #1
|cat2= Category number #2
|cat3= Category number #3
And so on. The example above only covers 7 categories, but you can add more to the code.