Perfect, just hit the same issue. At first I thought it wouldn't work for the case of having both SQL Server Standard & Express installed, but then noticed the "><" which after a bit of digging I discovered means left contains right, oddly I couldn't find mention of that conditional expression operator mentioned in the Wix docs, but did find it here: tramontana.co.hu/wix/lesson6.php.
–
BittercoderNov 11 '09 at 23:26

I tried Krzysztof's solution (above) - but on some machines when using this approach it wasn't correctly detecting when they did not have Sql Express installed.

It looked to be caused by mishandling of the REG_MULTI_SZ InstalledInstances registry value?

As I was checking to see if I needed to stop/restart the Sql Server Express service in the installer, I decided to just check against that instead - so here's my alternative, where I just check for the service instead:

All of the answers seem to make the same assumption - that the SQL Express instance is installed with an instance name of SQLEXPRESS. Whilst that is the default, it is changable.
–
Damien_The_UnbelieverJul 11 '12 at 13:15

That is true, so in place of SQLEXPRESS you should check for the instance name that you need, whatever it may be.
–
patrickbadleyJul 16 '12 at 13:18