If you want to assign query results to a single sObject instance, you must guarantee that the query will return exactly 1 record. Not zero, not 2 or more, exactly 1.
If you can't, there are two options. First is assign to a list and test the size:
List<Account> accts = [select name from Account where id = ???];
if (accts.size() == 1) {
...do something here...
}
Alternatively, you now know the exception you will recieve, so you can use try/catch.
Account myAcct;
try {
myAcct = [select name from Account where id = ???];
} catch (SearchException e) {
myAcct = new Account(); //or do something else, perhaps
}
I like this when I either need the retrieved record, or a new empty record. I commonly use this pattern in my Visualforce page controller constructor methods.
Note: I used the where Id = where clause as this implicitly returns a maximum of 1 record on the Force.com platform, but does not guarantee a record be returned in all cases.