Although the accepted solution by terdon♦ is brief and pretty, I would suggest something like:
unalias "$1" 2>/dev/null
status=$(command -v "$1")
case $status in
*"$1") echo "$1 found at $status";;
"") echo "Could not find $1. Aborting."; return 127;;
*) echo "Error: $status" >&2; return 1;;
It deals with two cases not dealt by the other method's here:
Aliases: they may hide an executable, but my function gives you the actual path to the executable only if there is one. The other methods will give you the alias definition and return a zero exit code, whether an actual command exists behind it or not.
Better error handling: Exit code 127 stands for "Command not found" type of errors, so you can have separate error handling for when a command is not found and when some other error occurs.
If there is some imponderable error (that is, an unknown error apart from the command not being found), it doesn't hide it, misleading you into thinking
gpg doesn't exist when it may. If you want to discard this errors, then call it like:
cmd_exists gpg 2>/dev/null
Regarding aliases, this may or may not be what you want, e.g. knowing an alias exists may be enough for you.
Unalias happens inside a subshell, so it won't mess your working shell's aliases.
Regarding error handling, I'm not a shell scripting expert, so I wouldn't know how likely an error would be in this situation nor if there's a better way to handle them.
So beware, this might be overkill.