Don’t use which(1) to determine where a command comes from; it’s an external program and uses hacks to get at aliases, etc.

Use your shell’s builtin command instead: «type» for #bash and #zsh and «whence» for #ksh.