External Code Execution on ARM Cortex M
The Cortex-M architecture doesn't put any restriction on the memories, it depends on the memory interfaces that are available on a specific controller.

For example, the LPC43xx allows to execute code from internal flash and RAM, external static RAM, NOR flash and serial flash (SPIFI).  I'm not sure about code execution in dynamic RAM as it is in an address range not normally used for code, but probably it is possible, too.

Note that external memories will generally be slower than internal ones.  The fastest is internal RAM.