There are two different ways to do this: Using a USB to SATA cable adapter or getting a USB thumb drive setup as a bootable drive first.
Using your working MacBook Pro download from the Apple App Store: Yosemite (OS-X 10.10) OS installer onto your system. Then run it to prep up the USB thumb drive, or if you have the cable prep the SSD directly.
With the USB method: Once the thumb drive is setup with the OS and you can boot up with it, lastly copy over to it the OS installer you're ready!
OK now you can swap out your internal drive. With the USB method: Using your USB thumb drive to boot up your system you can prep up your SSD.