If the hard drive is from a mid-2012 13" Macbook pro, the drive will physically fit inside any Macbook pro from 2010 and 2011. If the replacement is a mid-2010, early 2011, or late 2011, these are capable of running Sierra and, if they were running Sierra, the drive from the 2012 will probably boot the replacement without a problem.
If the damaged Macbook is a mid-2012 13" and the replacement is a Macbook pro that's an early 2011 or late 2011 13", the motherboard from the mid-2012 will fit inside the 2011. The mounting holes and connectors line up perfectly. Of course, this is only useful information if the 2012 motherboard is fully functional.