The ESP8266 (I'm not familiar with the ESP32) normally loads its software from an external Flash memory. That memory is built into the modules - e.g. the ESP-01 normally comes with a 512 kB Flash chip, the ESP-12 with a 4 MB Flash chip. It communicates with this chip using SPI on GPIO6-11, which for some modules (like the ESP12E) have been broken out.
Considering an SD card uses SPI as well, it may (at least in theory) be possible to have the ESP read its software from the SD card instead of an external Flash chip. That won't however allow you to choose which program to run, and it will be much slower than a regular Flash chip. You will have to design your own PCB with the ESP8266 chip (so basically build your own ESP module!), if it can work at all.
I think it is much easier to simply add the different functionalities in a single sketch, add some kind of boot menu to allow you to choose which functionality you want to use. If you do this a bit cleverly you can change on the fly, without the need to reboot.