I'm sure it depends on local laws but, in many cases, absolutely if the company wants to try to enforce it. At a minimum, they can make you spend a lot of money on lawyers.
Exactly. It’s not worth it to even find out. Every company I’ve worked for over the last decade or so has been very clear during orientation: they own everything you create, within or outside working hours, and using their equipment or your own equipment. Taking the risk to find out whether they will enforce it would mean spending $$$ that I don’t have on lawyers.