You're fortunate you could afford an attorney and successfully argue your case. Most of the folks under a non compete (like hourly restaurant workers!) probably can't do that.
On the other hand, for extremely top-level managers or workers with access to commercially sensitive information, I can understand the desire for non-competes, but we would typically solve that by having contractually agreed long notice periods (putting people on gardening leave for the notice period) and NDAs.
Which is what would happen if non-competes were outlawed.
So, yes, they are sometimes enforced.