How about:
=COLUMNS(TEXTSPLIT(A1,","))
In the case where a cell might be empty, use this:
=IF(A1="",0,COLUMNS(TEXTSPLIT(A1,",")))