Hi masuch. So, I still think, that best method will be 'hold' your package before any system, packages updates. Another way could be a process called - "pinning" packages (more info about pin can be found here ==>> AptPreferences). An example of entry in /etc/apt/preferences file to "pin" the older versions and packages related with your program;
(...) How can I prevent to overwrite anything what I have compiled/installed by me ? (...)
(...) If there is any way how to check the currently installed version against version is going to be installed (...)
1001 entry sets the value for all your_program versions begin with 1.0, regardless of the repository. A newer version (for example, starting with 1.1) is not installed, even if it is available, unless it would set an even higher priority. More info about APT-Pinning: http://jaqque.sbih.org/kplug/apt-pinning.html
Pin: version 1.0*
So, how APT utility interprets the value of Pin-Priority? Let see:
To check which version of packages is currently installed you can use e.g.
P < 0 : Version of the package will not be installed.
0 < P < 100 : Version of the package will be installed only if the package is not currently installed.
100 <= P < 500 : Version of the package will be installed, unless the version is available from another repository.
500 <= P < 990 : Version of the package will be installed, unless there is a version derived from the repository designated as the "target release" or actually installed a newer version of the package.
990 <= P <= 1000 : Version of the package will be installed even if you have a version derived from the repository designated as the "target release" unless you install a newer version of the package.
P > 1000 : Version of the package will be installed, even if it requires its withdrawal
For more detailed output, use this dpkg command without grep Version. To check which packages will be installed, you can simulate the update process. APT utility, allows such option and it is very interesting, because you do not have to install available updates, but only check what, eventually, could be installed.
$ dpkg -s firefox |grep Version
One more thing. You have written, that "if the package was not installed - to hold the package does not work". This seems to be a logical, right?
# simulating an update process;
$ sudo apt-get -s upgrade