Once an otherwise enforceable agreement has been found to exist, the next question is whether the non-compete provision is "ancillary" to that otherwise enforceable agreement. Texas courts have made it clear that the following must be true for a covenant not to compete to be ancillary to an otherwise enforceable agreement:
•The consideration given by the employer [in the otherwise enforceable agreement]
  must give rise to the employer’s interest in restraining the employee from competing.

•The covenant not to compete must be designed to enforce the employee’s return promise [contained in the otherwise enforceable agreement].

In the typical scenario, the employer contends that confidential information it provided to the employee gives rise to its interest in restraining competition. That contention intuitively makes sense:  if the employer gives the employee the employer’s most important secrets (e.g., financial information, customer lists, marketing strategies, research and development plans, etc.), it makes sense that the employer would not want the employee taking those to a competitor. Of course, the employee could always argue, "The non-disclosure agreement I signed prevents me from disclosing those items to a competitor, thus the non-compete is unnecessary." But the employer’s obvious rejoinder is, "Once you leave us and begin working for a competitor, our ability to monitor your activities is virtually nonexistent. Thus, we need not only a non-disclosure agreement, but also a covenant not to compete." In some cases, the employer is able to convince the court that the promises it made and the confidential information it gave justifies the non-compete provision. The employee’s promise not to disclose the confidential information usually satisfies the
second prong of the test.
To be confidential, information must be "secret," and if information is publicly available, it probably will not be deemed confidential. For example, information about customers that is publicly obtainable (e.g., from telephone books, industry journals, or even the employer’s website) may be held not to be confidential.

Confidential information is not necessarily the only consideration that can justify a covenant not to compete.  For example, giving an employee ownership in a company, particularly a privately-held business, may support a non-compete. However, confidential information may be the best consideration that can be given, because the connection between the information conveyed and the employer’s need to maintain its secrecy via a non-complete agreement makes sense.
Some employer promises that satisfy the otherwise enforceable agreement requirement may not satisfy the "ancillary" requirement. For example, an employer may satisfy the otherwise enforceable agreement requirement by giving the employee a term of employment. But a term of employment may be held insufficient to give rise to an interest in restraining competition. To determine whether a particular item of consideration is sufficient to support a non-compete covenant, one might ask, "Is there a logical relationship between the consideration given by the employer and the non-compete covenant the employer seeks to enforce?" If the consideration in question is confidential information, a logical relationship may be found to exist. But other types of consideration—e.g., a signing bonus—may be found lacking by that standard.
It is important to emphasize that the "ancillary" requirement is far easier to meet in the context of a purchase of a business than in an employment situation.  Another key difference between a non-compete agreement in a purchase of a business context and an employer/employee context: In the former, the burden is on the promisor (i.e., the person agreeing to be bound by the non-compete) to prove the agreement is unreasonable; in the latter, the promisee (employer) must prove the agreement is reasonable.