Amendments in matters of substance may be permitted in any action, in any stage of the proceedings, upon such terms as the court shall deem just and reasonable, when it shall appear to the court that it is necessary for the prevention of injustice; but the rights of third persons shall not be affected thereby.
RSA 514:9
RS 186:11. CS 198:11. GS 207:9. GL 226:9. 1879, 7:1. PS 222:8. PL 334 :9. RL 390:9.