(735 ILCS 5/2-617) (from Ch. 110, par. 2-617)
    Sec. 2-617. Seeking wrong remedy not fatal. Where relief is sought and the court determines, on motion directed to the pleadings, or on motion for summary judgment or upon trial, that the plaintiff has pleaded or established facts which entitled the plaintiff to relief but that the plaintiff has sought the wrong remedy, the court shall permit the pleadings to be amended, on just and reasonable terms, and the court shall grant the relief to which the plaintiff is entitled on the amended pleadings or upon the evidence. In considering whether a proposed amendment is just and reasonable, the court shall consider the right of the defendant to assert additional defenses, to demand a trial by jury, to plead a counterclaim or third party complaint, and to order the plaintiff to take additional steps which were not required under the pleadings as previously filed.
(Source: P.A. 82-280.)