@jlliagre
One place you can find reference to setuid and setgid being ignored is in "man ksh" in the section "Invoking ksh". Sounds like yours must be different.
There's a similar reference in Posix Shell manuals in the section "Shell Invocation".
More research has highlighted Solaris as a notable exception in the modern unix world. I'm pretty sure that suid scripts didn't work in SunOS 4.
It has been a problem to me in the distant past both when suid scripts did work and then when it suddenly stopped working!
Both "ksh" and the Posix Shell have a "-p" parameter. Indirectly the documentation for this switch explains the change of effective UID in your example.
With a bit of trial-and-error I managed to reproduce your test on HP-UX 11.1. The hint came from Sven Mascheck's site (below). On my tests it only works when there is a shebang line in the script.
With the original script owner as root and the permissions 4711 and while running as a non-priviliged user I used such a script to change a binary to permissions 6777 ! Scary.
Thankfully the passwd command doesn't work in a suid script (I already knew that). I've also checked that a non-privileged chown removes the suid bit.
This page from Sven Mascheck's excellent site has some decent lists and tables of O/S which allow suid scripts. The list omits a test result for HP-UX.
The #! magic, details about the shebang/hash-bang mechanism
This thread reinforces the old advice to not allow suid scripts and rubbishes the modern teaching and documentation that suid scripts don't work.