In any proceeding which involves the validity of a municipal ordinance or franchise, such municipality shall be made a party and shall be entitled to be heard, and if the statute, ordinance, or franchise is alleged to be unconstitutional, the attorney general of the state shall also be served with a copy of the proceeding and be entitled to be heard.
SDCL 21-24-8