It is not enough that your employer simply doesn't want you to take your skills and abilities to a competitor. There needs to be some good reason for the non-compete. For example, if the employer introduced you to all its best customers, it may have a legitimate interest in keeping you from going to a competitor and luring those customers away. The goodwill developed in terms of customer relations, gives the employer a competitive advantage. They may want to prevent you from capitalizing on it, thus they are entitled to protection.
Or, if you gained certain confidential knowledge that you would inevitably use in the course of working for your new employer, a court may find that to be a legitimate reason to uphold a non-compete agreement.