That in all actions now pending, or hereafter commenced in which judgment is rendered against any insurance company on any policy given to insure any property in this state against loss by fire, tornado, lightning or hail, the court in rendering such judgment shall allow the plaintiff a reasonable sum as an attorney's fee for services in such action including proceeding upon appeal to be recovered and collected as a part of the costs: Provided, however, That when a tender is made by such insurance company before the commencement of the action in which judgment is rendered and the amount recovered is not in excess of such tender no such costs shall be allowed.
K.S.A. 40-908