I was also facing the same problem. After putting in a great effort I came across this beautiful link
http://www.metatexis.net/manual_server/errorwhenusingmssqlservernamedpipesprovidercouldnotopenaconnectiontosqlserver.htm
The problem with my Sql Server was that I could login using USER-NAME account but not USER-NAME\SQLEXPRESS account. USER-NAME server had just Guest permissions whereas USER-NAME\SQLEXPRESS has complete permissions. You can check that by executing this query.
select user_name()
I went on to check whether my service is running or not. You can do that by clicking start and typing in "services.msc". Open that and search for "SQL Server (SQLEXPRESS)". Start it if its not already started.
In my case it was disabled. I right clicked it. Went to properties and changed "Startup type" to "Automatic".
After doing all this I started Sql Server Management Studio again and connected using USER-NAME\SQLEXPRESS and it worked.
Cheers,