It depends.. Once upon in the time, most external HDDs were ordinary (slow) harddrives with USB-to-SATA (or USB-to-IDE) interface board. Then, some manufacturers (WD Passport is an example) started cutting the SATA interface altogether, and used proprietary connection between the drive and the USB interface.
So, YMMV. If you have the drive and don't mind opening (damaging) it, go forward. If you have found a terrific deal on external SSD way cheaper than corresponding internal SSD - you will take the risk.
There is still a chance that the SSD placed into the external enclosure is slower (being limited by tge USB interface).