One easy way to check for installed packages using apt-mark
:
apt-mark showinstall
will list all packages marked install (already installed, or queued for installation). After that, it's a simple matter of grepping the package(s) you care about.
Example: apt-mark showinstall | grep -q "^$PACKAGE_NAME$" && echo "installed" || echo "not"