Scrambled screen when going out of sleep With my 2011 MBP, when connected to my external screen I always encounter an issue when waking up from sleep mode, if the lid was closed (and only if lid is closed from what my tests show).
To summarize:


MBP + External screen + Lid closed
Wake-up with scrambled external screen and black MBP screen. MBP frozen.
MBP + External screen + Lid not closed
Wake-up normally from sleep mode.
MBP without external screen (lid closed or not)
Wake-up normally from sleep mode.


Do you have any idea of what could cause this and how I could fix the issue?  

Here is how my external screen looks like after a wake-up in the first case:  



I've seen this issue but it's for older version of MBP and my system is up to date regarding the Software Update option.



Edit: Last EFI update installed yesterday seems to have fixed the issue!



Last update:

Several years without any issue and then, recently, having really serious issues appearing (MBP freezing or rebooting (console showing gpuRestart crash logs)), I went to the Apple Store.

They changed the GPU (hence the full motherboard). This was free because of an extended repair program for this very specific problem. See details here. Program ends in Feb 2016, so hurry up in case you have the same issue!
Although it's likely a hardware issue, you could try a few things if you don't want to get hardware help from Apple yet.


See if this happens when booting in Safe Mode.
Install a clean OS on an external drive to be sure it's not some extension or conflict.
Look in the console logs - see if you can see any obvious errors.
Try with other monitors and cables - it could be a bad cable or display. An EFI or firmware update might be needed to make the mac handle this situation better (it should never freeze) - and a report to Apple with details how to reproduce this might help get a fix sooner unless others have reported this specific combination.
If you have alternate RAM - do try swapping that in for testing. The newest macs use RAM heavily for display buffering - and wake from sleep is a time when you first can see issues with RAM going bad.


I'm lucky to have stores close by and would head there for a diagnostic checkup - so keep that in mind - it could just be a hardware failure / bad RAM, but anything you can do to narrow down the cause or rule out software / accessories by disconnecting everything but the bare minimum could save you a trip to the shop.