Where any defendant in any action, or plaintiff in replevin, pleads several matters, and any of such matters, upon a motion directed to the complaint, answer or reply, is adjudged insufficient, or if judgment is entered, in any issues of the cause, for the plaintiff, costs shall be awarded at the discretion of the court.
735 ILCS 5/5-111