Using first-principles calculations based on density functional theory, we have studied the mechanical, electronic, and magnetic properties of Heusler alloys, namely, Ni$_{2}BC$ and Co$_{2}BC$ ($B$ = Sc, Ti, V, Cr and Mn as well as Y, Zr, Nb, Mo and Tc; $C$ = Ga and Sn). On the basis of electronic structure (density of states) and mechanical properties (tetragonal shear constant), as well as magnetic interactions (Heisenberg exchange coupling parameters), we probe the properties of these materials in detail. We calculate the formation energy of these alloys in the (face-centered) cubic austenite structure to probe the stability of all these materials. From the energetic point of view, we have studied the possibility of the electronically stable alloys having a tetragonal phase lower in energy compared to the respective cubic phase. A large number of the magnetic alloys is found to have the cubic phase as their ground state. On the other hand, for another class of alloys, the tetragonal phase has been found to have lower energy compared to the cubic phase. Further, we find that the values of tetragonal shear constant show a consistent trend : a high positive value for materials not prone to tetragonal transition and low or negative for others. In the literature, materials, which have been seen to undergo the martensite transition, are found to be metallic in nature. We probe here if there is any Heusler alloy which has a tendency to undergo a tetragonal transition and at the same time possesses a high spin polarization at the Fermi level. From our study, it is found that out of the four materials, which exhibit a martensite phase as their ground state, three of these, namely, Ni$_{2}$MnGa, Ni$_{2}$MoGa and Co$_{2}$NbSn have a metallic nature; on the contrary, Co$_{2}$MoGa exhibits a high spin polarization.