Could any one please tell me how to code whether a database exists or not in sql azure ?
Have you tried querying the sys.databases table? That should give you what you're looking for. More info here.
Note: You'll want to run this query against the Master database. Otherwise, you'll only see the name of the current database (and Master).