Passing Table Names to IB6.0 Stored Procedures

Can this be done ???
If so - what is wrong with the following:

I am passing the Table name and the KeyField name to get
the Next KeyID value.

May not be the best way for this purpose, but it will be uses for other
joint type sp's if this concept works..

SET TERM !! ;
CREATE PROCEDURE sp_NEXTID (aTable varchar(30), aKey VarChar(30))
RETURNS (IDValue Integer)
AS
BEGIN
  select Max(:aKey) + 1 from :aTable Into :IDValue;
  EXIT;
END !!
SET TERM ; !!

Thanks for any help received

Bob