The invention belongs to preparation of new genes, and particularly provides a gene GmCTRL2 used for improving osmotic stress resistance of alfalfa, preparation and a protein coded by the gene GmCTRL2. The gene GmCTRL2 is prepared by a PCR (Polymerase Chain Reaction) amplification method with 5'-ATAGG TACCGAGCTCTCAGATCCAAATAAATCATG-3'serving as a forward primer S1, 5'-CTGGGATCCCTC GAGCCTCAGCTATATATCCATTG3' serving as a reverse primer A1, and cDNA (complementary Deoxyribose Nucleic Acid) serving as a template, wherein the cDNA is synthesized by the reverse transcription of RNA (Ribose Nucleic Acid) in root, stem and leaf organization of soybean subjected to salt stress treatment. The gene GmCTRL2 solves the problems in the prior art that plants are lack of resistance genes, and the resistant spectrum, adaptive ecological zones and resistance mechanisms and the like of most of the genes are unclear, and has the advantage that the salt tolerance and drought resistance of a transgenic callus are improved obviously by comparing with a wild type callus.