Yes,your t-mobile sim card will work in another phone if it is an unlocked one.If your phone is locked you need to unlock it with the help of unlock codes.
Unlock codes can be got from Mobileunlocksolutions.com where you need to mention your phone model.They provide you with unlock code and free unlocking instructions.