The exists command returns true if the argument is a valid command, subroutine, or script.
if (exists("sphere")) {
	sphere; // make a sphere
}
 
	 The objExists function returns true when an object exists with a certain name:
sphere -name "george";
// Result: george makeNurbSphere1 //
print(objExists("george"));
1
print(objExists("martha"));
0
 
	 Use attributeExists to check whether a given attribute exists on a node. The command has the form:
attributeExists("attributeName","nodeName")
 
		For example:
if (attributeExists("visibility","mySphere")) {
	setAttr mySphere.visibility on;
}