In an action to recover a real estate commission, the plaintiff appeals from an order of the Supreme Court, Westchester County (Rubenfeld, J.), entered February 9, 1987, which granted the defendants’ motion to disqualify counsel for the plaintiff.
Ordered that the order is affirmed, with costs.
The plaintiff Lawrence Bridges commenced the action at bar seeking, inter alia, the recovery of a $30,000 real estate commission allegedly earned in connection with the sale of a certain premises in Westchester County. Insofar as pertinent here, the relevant paragraphs of the complaint allege that the seller of the premises, the defendant Alcan Construction Company (hereinafter Alcan), expressed uncertainty with regard to proceeding with the sale after it allegedly became concerned with the reputation of the defendant Howard L. Parnés, whom the plaintiff contends controlled the purchasing company, T.K.V. Realty Corp. (hereinafter TKV), as his alter ego, and intended for TKV to purchase the premises for the sole purpose of assigning the contract at a profit. Paragraphs 20 to 22 of the complaint, the key paragraphs for the purposes of this appeal, allege that despite Alcan’s reservations, the contract was nevertheless "revived” through the intercession of the plaintiff’s attorneys, who reassured and ultimately convinced Alcan to proceed with the sale to TKV.
Paragraph 22 of the complaint alleges that by virtue of counsel’s intercession and "revivfal]” of the contract, the plaintiff was entitled to a commission. The sale, however, was never consummated and Alcan sold the premises to a third party in a transaction in which the plaintiff had apparently no involvement.
Shortly after the commencement of the plaintiff’s suit, the defendants moved to disqualify the plaintiff’s counsel on the *317ground that paragraphs 20 to 22 of the complaint revealed that counsel’s testimony on the plaintiffs behalf would be necessary at any trial of the action. The Supreme Court agreed and disqualified the plaintiffs counsel. We affirm.
When faced with a disqualification motion, "the court’s function is to take such action as is necessary to insure the proper representation of the parties and fairness in the conduct of the litigation” (Solomon v New York Prop. Ins. Underwriting Assn., 118 AD2d 695). A court may disqualify an attorney to avoid the appearance of impropriety (see, Code of Professional Responsibility Canon 9; Cardinale v Golinello, 43 NY2d 288; Solomon v New York Prop. Ins. Underwriting Assn., supra).
As this court has recently stated, "[i]t is well settled that an attorney may not accept employment in contemplated or pending litigation if he knows or it is obvious * * * that he or a member of his firm ought to be called as a witness, and if an attorney learns or it becomes obvious to him, after employment in litigation is undertaken, that he or a member of his firm ought to be called as a witness on behalf of his client, the attorney must withdraw” (Solomon v New York Prop. Ins. Underwriting Assn., supra, at 695-696; see, Code of Professional Responsibility DR 5-102). At bar, counsel’s testimony with respect to his "reviv[al]” of the contract is central to the plaintiffs theory of recovery in that the complaint specifically alleges that it was by reason of counsel’s intervention—and the agreement he arranged among the parties to "revive” the contract—that the plaintiff’s entitlement to the commission arose. In light of the foregoing, we cannot say that the Supreme Court improvidently exercised its discretion in disqualifying the plaintiffs counsel. In any event, in such a situation any doubt is to be resolved in favor of disqualification (see, Seeley v Seeley, 129 AD2d 625; Solomon v New York Prop. Ins. Underwriting Assn., supra). Mollen, P. J., Bracken, Rubin, Kooper and Spatt, JJ., concur.